"""
@title(TenX腾晓2024年11月考核答题文件)
@warning(请勿修改参数和返回值)
@warning(请认真填写__init__中的数据)
@author(1323230180)
"""
from typing import List, Tuple


class TenXClass:
    def __init__(self):
        self.name = "许敏熹"
        self.id = "3224002032"

    @staticmethod
    def question1(n: int) -> list[str]:
        print(n)  # 打印，防止IDE警告
        list1 = []
        for a in range(1, n + 1):
            t = a
            c = 0
            ret = 0
            while t > 0:
                digit = t % 4
                ret += digit * (10 ** c)
                c += 1
                t //= 4
            ret = str(ret)
            list1.append(ret)
        print(list1)
        return list1

    @staticmethod
    def question2() -> list[tuple[int, int, int]]:
        list2 = []
        for x in range(0, 21):
            for y in range(0, 34):
                for z in range(0, 301):
                    sum1 = 5 * x + 3 * y + z / 3
                    if x + y + z == 100:
                        if sum1 == 100:
                            list2.append((x, y, z))
        print(list2)
        return list2

    @staticmethod
    def question3(equipment: list[str], prop: list[str], material: list[str], items: list[str]) -> dict[str, list[str]]:
        print(equipment, prop, material, items)  # 打印，防止IDE警告
        eq = []
        pr = []
        ma = []
        for a in items:
            for b in equipment:
                if a == b:
                    eq.append(a)
                    break
            for c in prop:
                if c == a:
                    pr.append(a)
                    break
            for d in material:
                if d == a:
                    ma.append(a)
                    break
        ret = {
            "equipment": eq,
            "prop": pr,
            "material": ma
        }
        print(ret)

        return ret

    @staticmethod
    def question4(item_values: dict[str, int], items: list[str]) -> tuple[list[str], int]:
        print(item_values,items) # 打印，防止IDE警告
        sum2 = 0
        max1 = []
        for a in range(0, len(items)):
            for b in range(0, len(items)):
                for c in range(0, len(items)):
                    if a != b:
                        if a != c:
                            if b != c:
                                sum1 = item_values[items[a]] + item_values[items[b]] +item_values[items[c]]
                                if sum1 >= sum2:
                                    max1 = [items[a], items[b], items[c]]
                                    sum2 = sum1
        ret = (max1, sum2)
        return  ret

    @staticmethod
    def question5(matrix: list[list[int]]) -> list[tuple[int, int]]:
        print(matrix)  # 打印，防止IDE警告
        ret = []
        for a in range(0, len(matrix)):
            for b in range(0, len(matrix[0])):
                if matrix[a][b] == 0:
                    ret.append((a + 1, b + 1))
        print(ret)
        return ret
